import type { ProFormInfo } from '../../utils/types';

// 初始化配置
export const initConfig = (): ProFormInfo => {
  ///开始formInfo
  return {
    forms: {
      detail: {
        formConfig: {},
        formFields: [],
      },
      add: {
        formConfig: {},
        formFields: [],
      },
      edit: {
        formConfig: {},
        formFields: [],
      },
    },
    // 数据源配置
    dataSource: {
      // 数据主键信息
      keyInfo: {
        key: 'id',
        value: 5,
      },
      apiList: {
        list: {
          url: '/api/selectList',
          method: 'Post',
          afterScript: 'returnData=response.data',
          parameter: {},
          body: {},
        },
        detail: {
          url: '/api/selectDetail',
          method: 'Get',
          afterScript: 'returnData=response.data',
          parameter: {},
          body: {},
        },
        add: {
          url: '/api/add',
          method: 'Post',
          afterScript: 'returnData=response.data',
          parameter: {},
          body: {},
        },
        delete: {
          url: '/api/delete',
          method: 'Get',
          afterScript: 'returnData=response.data',
          parameter: {},
          body: {},
        },
        update: {
          url: '/api/update',
          method: 'Post',
          afterScript: 'returnData=response.data',
          parameter: {},
          body: {},
        },
        deleteBatch: {
          url: '',
          method: 'Post',
          afterScript: '',
          parameter: {},
          body: {},
        },
      },
    },
  };
  ///结束formInfo
};

///开始删除
// 表单样式默认配置
export const defaultProFormConfig = {
  // 表单自带属性
  readonly: true, // 是否只读
  layout: 'horizontal',
  labelCol: { span: 4 },
  wrapperCol: { span: 14 },
  size: 'small', // 尺寸 'small' | 'middle' | 'large' | undefined;
  // 额外字段
  submitWrapperCol: { span: 20, offset: 4 }, // 提交按钮布局
  showReset: true,
  resetText: '重置',
  showSubmit: true,
  submitText: '提交',
};
///结束删除
